import request from '../utils/request'
import config from '../config'

/*
 * 首页接口
 * @author： 黄
 */

/*
 * @desc 获取首页数据
 * @param {number} departmentid 机构id或者分店id
 * @return {promise}
 */
async function getWeiXinConfig (departmentid) {
  let res = await request(config.apiList.getWeiXinConfig, { departmentid: departmentid })
  if (res) {
    return res
  }
}

/*
 * @desc 获取最新文章
 * @param {number} shopid 分店id
 * @return {object} articleList
 */
async function getArticleList (shopid, page) {
  return request(config.apiList.getArticleList, { shopid: shopid, page: page })
}

/*
 * @desc 获取单个文章
 * @param {number} id 文章id
 * @return {object} article
 */
async function getArticleInfo (id) {
  return request(config.apiList.getArticleInfo, { id: id })
}

export {
  getWeiXinConfig,
  getArticleList,
  getArticleInfo
}
